package com.bwie.asyncs;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;

@Service
@EnableAsync
public class AsyncCreateTest {
    @Async("asyncyqw")
    public void test1(){
        System.out.println("线程测试1启动");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程测试1结束");
    }
    @Async("asyncyqw")
    public void test2(){
        System.out.println("线程测试2启动");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程测试2结束");
    }

    @Async("asyncyqw")
    public void test3(){
        System.out.println("线程测试3启动");
        Integer s = 1/0;
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程测试3结束");
    }
}
